const path = require('path')

module.exports = {
    publicPath: './',
    configureWebpack: {
        resolve: {
            alias: {
                Api: path.resolve(__dirname, './src/api/'),
                Assets: path.resolve(__dirname, './src/assets/'),
                Styles: path.resolve(__dirname, './src/assets/styles/'),
                Components: path.resolve(__dirname, './src/components/'),
                Layouts: path.resolve(__dirname, './src/layout/'),
                Utils: path.resolve(__dirname, './src/utils/'),
                Views: path.resolve(__dirname, './src/views/')
            }
        }
    },
    devServer: {
        proxy: {
            '/mApi': {
                target: 'http://m.kugou.com',
                changeOrigin: true,
                pathRewrite: { // 重写路径 目的是把/api开始的接口重写 （如/api/users 改成/users）
                    '^/mApi': '/'
                }
            },
            '/Api': {
                target: 'http://m.kugou.com',
                changeOrigin: true,
                pathRewrite: { // 重写路径 目的是把/api开始的接口重写 （如/api/users 改成/users）
                    '^/Api': '/'
                }
            },
            '/cdnApi': {
                target: 'http://mobilecdn.kugou.com',
                changeOrigin: true,
                pathRewrite: {
                    '^/cdnApi': '/'
                }
            }
        }
    }
}
